package com.ftg.learn.chapter09.reflech.demo03;

import com.ftg.learn.chapter09.reflech.demo03.ioc.BeanFactory;
import com.ftg.learn.chapter09.reflech.demo03.ioc.BeanFactoryImpl;
import com.ftg.learn.chapter09.reflech.demo03.ioc.DetailList;

/**
 * @author kangjx
 * @createTime 2023/1/13
 */
public class Consumer {

    public static void main(String[] args) {

        BeanFactory beanFactory = new BeanFactoryImpl();

        beanFactory.putBeanIntoContainers(new DetailList("dog1","com.ftg.learn.chapter09.reflech.demo03.pojo.Dog"));
        beanFactory.putBeanIntoContainers(new DetailList("dog2","com.ftg.learn.chapter09.reflech.demo02.entity.Dog"));

        //使用
        com.ftg.learn.chapter09.reflech.demo03.pojo.Dog dog1 = (com.ftg.learn.chapter09.reflech.demo03.pojo.Dog) beanFactory.getBean("dog1");
        com.ftg.learn.chapter09.reflech.demo02.entity.Dog dog2 = (com.ftg.learn.chapter09.reflech.demo02.entity.Dog) beanFactory.getBean("dog2");


        System.out.println(dog1);
        System.out.println(dog2);

    }

}
